package com.example.educationalsystem.entity;

import java.math.BigDecimal;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;

import java.time.LocalDate;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;

import com.example.educationalsystem.common.util.LocalDateConverter;
import com.example.educationalsystem.common.util.LocalDateTimeConverter;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 * 
 * </p>
 *
 * @author zpc
 * @since 2022-12-02
 */
@ColumnWidth(30)//注释在具体属性上,设置单独列。注释在类上,统一设置列宽
@HeadRowHeight(30)//设置表头行高
@ContentRowHeight(20)//统一设置数据行行高
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("course")
@ApiModel(value="Course对象", description="")
public class Course extends Model<Course> {

    private static final long serialVersionUID = 1L;

    @ExcelProperty(value = "课程编号")
    @ApiModelProperty(value = "课程编号:202001")
    @TableId("course_id")
    private String courseId;

    @ExcelProperty(value = "课程名称")
    @ApiModelProperty(value = "课程名称:计算机网络")
    @TableField("course_name")
    private String courseName;

    @ExcelProperty(value = "课程类型")
    @ApiModelProperty(value = "课程类型:专业必修课")
    @TableField("course_type")
    private String courseType;

    @ExcelProperty(value = "课程学分")
    @ApiModelProperty(value = "课程学分:2.0")
    @TableField("course_credit")
    private BigDecimal courseCredit;

    @ExcelProperty(value = "课程描述")
    @ApiModelProperty(value = "课程描述:计算机网络理论")
    @TableField("course_desc")
    private String courseDesc;

    @ExcelProperty(value = "上课教室编号")
    @ApiModelProperty(value = "上课教室编号")
    @TableField("classroom_id")
    private String classroomId;

    @ExcelProperty(value = "课程开课时间",converter = LocalDateConverter.class)
    @ApiModelProperty(value = "课程开课时间")
    @TableField("course_begin_time")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+")
    private LocalDate courseBeginTime;

    @ExcelProperty(value = "课程结束时间",converter = LocalDateConverter.class)
    @ApiModelProperty(value = "课程结束时间")
    @TableField("course_end_time")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+")
    private LocalDate courseEndTime;

    @ExcelProperty(value = "上课时间段")
    @ApiModelProperty(value = "上课时间段")
    @TableField("course_times")
    private String courseTimes;

    @ExcelProperty(value = "上课老师工号")
    @ApiModelProperty(value = "上课老师工号")
    @TableField("teacher_id")
    private String teacherId;

    @ExcelProperty(value = "上课学生人数限制")
    @ApiModelProperty(value = "上课学生人数限制")
    @TableField("course_limit_count")
    private Integer courseLimitCount;

    @ExcelProperty(value = "实际选课人数")
    @ApiModelProperty(value = "实际选课人数")
    @TableField("course_actual_count")
    private Integer courseActualCount;

    @Override
    protected Serializable pkVal() {
        return this.courseId;
    }

}
